//package com.icehelper.hades.base.hanlder;
//
//import com.icehelper.hades.base.controller.BizResponse;
//import com.icehelper.hades.base.exception.CommonErrorCode;
//import com.icehelper.hades.base.exception.HadesErrorCodeException;
//import com.icehelper.hades.base.exception.IErrorCode;
//import lombok.extern.slf4j.Slf4j;
//import org.aspectj.lang.ProceedingJoinPoint;
//import org.aspectj.lang.annotation.Around;
//import org.aspectj.lang.annotation.Aspect;
//import org.springframework.stereotype.Component;
//
///**
// * @author Leon Sun
// * @Date 2022/5/17
// * @Description rpc 调用异常捕获处理
// */
//@Aspect
//@Component
//@Slf4j
//public class RpcExceptionHanlder{
//
//	@Around( "@annotation(com.icehelper.hades.base.exception.annotation.RpcException)  || @within(com.icehelper.hades.base.exception.annotation.RpcException)" )
//	public Object excute( ProceedingJoinPoint proceedingJoinPoint ){
//		try{
//			return proceedingJoinPoint.proceed();
//		} catch( Throwable throwable ){
//			log.error( "ServiceExcepHandler serviceExcepHandler failed", throwable );
//			BizResponse response = new BizResponse();
//			//单独处理缺少参数异常
//			if( throwable instanceof HadesErrorCodeException ){
//				IErrorCode errorCode = ( ( HadesErrorCodeException )throwable ).getErrorCode();
//				response.setCode( errorCode.code() );
//				response.setMessage( errorCode.msg() );
//				return response;
//			}else{//其他正常返回
//				response.setCode( CommonErrorCode.SERVER_ERROR.code() );
//				response.setMessage( throwable.getMessage() );
//			}
//			return response;
//		}
//
//	}
//}
